<?php

/**
 * Controleur permettant de lister l'ensemble des clients
 */
require_once('dao/ClientDao.php');
//if ($_SESSION['niveauAuth']=='1' or $_SESSION['niveauAuth']=='3' or $_SESSION['niveauAuth']=='4'or $_SESSION['niveauAuth']=='7' or $_SESSION['niveauAuth']=='8') {
// Initialisation des variables
$searchId = "";

$offres = null;
if(isset($_GET['action'])) {
ClientDao::deleteoffre($_GET['idd']);
}
if(isset($_SESSION['user'])){
	$offres1 = ClientDao::searchByoffrefixe($_SESSION['user']);
	if (count($offres1) == 0){
		$error="Aucune offre fixe";
	} 
	$offres2 = ClientDao::searchByoffrevoip($_SESSION['user']);
	if (count($offres2) == 0){
		$error="Aucune offre voip";
	} 
	
} else {
	$error="Client non précisé !";
}

// Rendu de la page
echo $twig->render('detail-offre-client-util-fixe.html', 
		array(	'offres' => array_merge($offres1,$offres2),
				'message' => $message, 
				'error' => $error));

//}
//else {
//	redirect("home-admin");
//}